<template>
  <div>
    <h1>购物车</h1>

    <p>购物车商品数量：{{ $store.getters.length }}</p>
    <p>购物车总价：{{ total }}</p>
  </div>
</template>

<script>
import { mapGetters } from "vuex";

export default {
  computed: {
    ...mapGetters(["length", "total"]),
  },

  // computed: {
  //   length() {
  //     return this.$store.getters.length;
  //   },
  //   total() {
  //     return this.$store.getters.total;
  //   },
  // },

  created() {
    console.log(this.$store);
  },
};
</script>
